﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using PeiYue.Api.Controllers.BASE;
using PeiYue.Common;
using PeiYue.Common.HttpContextUser;
using PeiYue.IServices.Common;
using PeiYue.IServices.Tms;
using PeiYue.Model;
using PeiYue.Model.Dto.Tms;
using PeiYue.Model.Models.Tms;

namespace PeiYue.Api.Controllers.Tms
{
    /// <summary>
    /// 司机任务详情管理
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    [Authorize(Permissions.Name)]
    public class TaskDetailController : BaseController<TaskDetailDao>
    {
        readonly ITaskDetailServices _taskDetailServices;
        readonly IUser _user;
        readonly IMapper _mapper;
        public TaskDetailController(ITaskDetailServices taskDetailServices, IImgResDaoServices imgResDaoServices, IUser user, IMapper mapper):base(taskDetailServices,user)
        {
            _taskDetailServices = taskDetailServices;
            _user = user;
            this._mapper = mapper;
        }
        /// <summary>
        /// 获取任务详情分页列表
        /// </summary>
        /// <param name="requestDto">查询参数</param>
        /// <returns></returns>
        [HttpGet]
        public async Task<MessageModel<PageModel<SearchTaskDetailResponseDto>>> GetList([FromQuery]SearchTaskDetailRequestDto requestDto)
        {
            var data = await _taskDetailServices.GetPage(requestDto);
            return new MessageModel<PageModel<SearchTaskDetailResponseDto>>()
            {
                msg = "获取成功",
                success = true,
                response = data
            };
        }
    }
}